package object;

/**
 * @Author:Cjj
 * @Date:2025-4-26 11:26
 * 构造方法重载
 */
public class DaXia {
    String name;

    String waihao;
    int age;
    String bangPai;

    //构造方法
    public DaXia(String name,int age,String bangPai){
        this.name = name;
        this.age = age;
        this.bangPai = bangPai;
    }

    //构造方法也是方法,也可以进行重载
    public DaXia(String name,int age,String waihao,String bangPai){
       this(name,age,bangPai);//this还可以调用当前类中其他的方法
        this.waihao = waihao;
   
    }
    public static void main(String[] args) {
        DaXia daXia = new DaXia("小明", 18, "哈哈哈", "白派");
        DaXia daXia1 = new DaXia("张三", 15, "白派");
        System.out.println(daXia.name+" "+daXia.age+" "+daXia.waihao+" "+daXia.bangPai);
        System.out.println(daXia1.name+" "+daXia1.age+" "+daXia1.bangPai);


    }
}


